<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Forpastime < forpastime@qq.com>
// +----------------------------------------------------------------------
namespace app\tenant_user\controller;

use cmf\controller\HomeBaseController;
use app\partner\model\AreaModel;
use think\Db;

class IndexController extends HomeBaseController
{
    function getCity()
    {
        $province_id = $this->request->param('province_id','0','intval');
        if($province_id>0){
            $area = new AreaModel();
            $city = $area->city($province_id);
            $data = ['code'=>1,'city'=>$city];
            return $data;
        }else{
            $this->error('fail');
        }
    }

    function getCountry()
    {
        $city_id = $this->request->param('city_id','0','intval');
        if($city_id>0){
            $area = new AreaModel();
            $county = $area->country($city_id);
            $data = ['code'=>1,'county'=>$county];
            return $data;
        }else{
            $this->error('fail');
        }
    }
}